#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int ans;
int cnt;
int m;
int vis=0;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        scanf("%d",&m);
        a[m]+=1;
    }
    for(int i=1;i<=100000;i++){
        if(a[i]==0) continue;
        if(vis==0){
                ans+=a[i];
                vis=1;
                continue;
        }
        if(a[i]-(ans-cnt)>=0){
                cnt+=ans-cnt;
        }
        else{
            cnt+=a[i];
        }
        ans+=a[i];
    }
    cout<<n-cnt<<endl;
    return 0;
}

